import axios from '@/libs/axios1'
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' }
let base = '/testplatform/vulnerabilityVerifyTemplate'

// 查询漏洞验证工程模版列表
export const getVerifyProjectTemplateList = params => {
  return axios({
    url: `${base}/page`,
    method: 'GET',
    headers: jsonHeaders,
    params
  })
}

// 修改漏洞验证工程模版
export const updateVerifyProjectTemplate = data => {
  return axios({
    url: `${base}/update`,
    method: 'PUT',
    headers: jsonHeaders,
    data
  })
}

// 删除漏洞验证工程模版
export const deleteVerifyProjectTemplate = data => {
  return axios({
    url: `${base}/delete`,
    method: 'DELETE',
    headers: jsonHeaders,
    data
  })
}

// 将漏洞验证工程保存为模板
export const saveVerifyProjectTemplate = (projectId, data) => {
  return axios({
    url: `${base}/saveTemplate/${projectId}`,
    method: 'POST',
    headers: jsonHeaders,
    data
  })
}

// 获取漏洞验证工程模版关联的漏洞列表
export const getTemplateVulnerability = params => {
  return axios({
    url: `${base}/vulnerabilityTemplatePage`,
    method: 'GET',
    headers: jsonHeaders,
    params
  })
}

// 根据漏洞模版构建工程
export const createProjectByVulnerabilityTemplate = id => {
  return axios({
    url: `${base}/fastVerifyProject/${id}`,
    method: 'POST',
    headers: jsonHeaders
  })
}